from flask import Flask, request, make_response
from flask_cors import CORS

import data.palu_info as palu
import data.wy_trans_lng_info as wyTransLng
import data.open_ai as ai

server = Flask(__name__)
CORS(server, resources=r'/*')


# 获取帕鲁数据接口
@server.route('/getPaluJsonData', methods=['GET', 'POST'])
def get_palu_json():
    return palu.get_json_data()


# 获取网易翻译支持语言类型接口
@server.route('/getWyTransLngData', methods=['GET', 'POST'])
def get_wy_trans_lng_json():
    return wyTransLng.get_json_data()

# @server.route('/openai', methods=['GET', 'POST'])
# def openai():
#     res = {
#         'code': 0,
#         'answer': "",
#     }
#
#     if request.method == 'POST':
#         message = request.get_json()['message']
#         answer = ai.get_completion(message)
#         res['answer'] = answer
#     return make_response(res)


if __name__ == '__main__':
    server.run(debug=True, host='0.0.0.0', port=8701)
